Home:ALL Converter>about common types declaration in python

about common types declaration in python

Ask Time:2022-05-31T09:52:39         Author:aaron

Json Formatter

Usually I'd like to define all common data type in a module called types.py. However, chances are it's collide with types from python standard library.

For example, the following code will cause circular imports:

# types.py

import logging

the logging module will import re, and re will import from types. However, this time types is referred as standard library.

My question is, what's best name for collect common data types in a file? I have some options like constants, coretypes, datatypes, but none of them seems perfect

Author:aaron,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/72441480/about-common-types-declaration-in-python
yy